package com.dlwx.parttimetalent.views;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.NumberPicker;
import android.widget.TextView;

import com.dlwx.parttimetalent.R;
import com.dlwx.parttimetalent.inter.DialogInter;
import com.flyco.dialog.widget.base.BaseDialog;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/11/21.
 */

public class EducationDialog extends BaseDialog {
    @BindView(R.id.np_education)
    MyNumberPicker npEducation;
    @BindView(R.id.tv_cancel)
    TextView tvCancel;
    @BindView(R.id.tv_confirm)
    TextView tvConfirm;
    private Context context;
    private String[] times;
    private  DialogInter inter;

    public EducationDialog(Context context, DialogInter inter) {
        super(context);
        this.context = context;
        this.inter=inter;
    }

    @Override
    public View onCreateView() {
        widthScale(0.85f);
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_education,null);
        ButterKnife.bind(this, view);
//        initView();
        return view;
    }

    private void initView() {

    }

    @Override
    public void setUiBeforShow() {
        npEducation.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
        times = new String[]{"小学", "初中", "高中", "大专", "本科", "研究生", "博士", "博士后"};
        npEducation.setDisplayedValues(times);
        npEducation.setMinValue(0);
        npEducation.setMaxValue(times.length - 1);
        npEducation.setValue(0);
    }

    @OnClick({R.id.tv_cancel, R.id.tv_confirm})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_cancel:
                this.dismiss();
                break;
            case R.id.tv_confirm:
//                LogUtils.d("vale:"+npEducation.getValue());
                inter.getInfo(times[npEducation.getValue()]);
                this.dismiss();
                break;
        }
    }
}
